/**
 * 
 */
package com.zc.BankCreditManagement.Servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zc.BankCreditManagement.ServiceImpl.CustomerServiceImpl;

/**
 * @author ZhangCheng
 * @time 2019年10月9日
 */
@WebServlet("/AdminServlet")
public class AdminServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8516184128267444663L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String type = req.getParameter("Type");
		if("autoGenerateCusId".equals(type)) {
			autoGenerateCusId(req,resp);
		}
	}
	
	private void autoGenerateCusId(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		CustomerServiceImpl cSI = new CustomerServiceImpl();
		resp.getWriter().write(cSI.generateCusId()+"");
	}
}
